package com.gper.edu.vip.builder.prototype;

import lombok.Data;

import java.util.List;

/**
 * @Author: ellis.guan
 * @Description: 浅克隆原型对象
 *
 * @Date: 2020/2/29 20:29
 * @Version: 1.0
 */
@Data
public class ShallowClonePrototype implements Cloneable {

    private String name;
    private int age;
    private List<String> hobbies;

    public ShallowClonePrototype(String name, int age, List<String> hobbies) {
        this.name = name;
        this.age = age;
        this.hobbies = hobbies;
    }

    @Override
    public ShallowClonePrototype clone() throws CloneNotSupportedException {
        return (ShallowClonePrototype)super.clone();
    }

    public List<String> getHobbies() {
        return hobbies;
    }

    public void setHobbies(List<String> hobbies) {
        this.hobbies = hobbies;
    }

    @Override
    public String toString() {
        return "ShallowClonePrototype{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", hobbies=" + hobbies +
                '}';
    }
}
